## 15.3. PPP over ISDN

ISDN has offered convenient, high-speed data communications--at a price--for many years; it is particularly popular in Europe where rates and marketing have been more favorable to its use than in the United States. ISDN, which integrates data and regular voice transmission over a single line, offers both a faster connection setup and much better throughput than traditional modems.

ISDN lines can transfer 64 kbits/second. And unlike analog lines, they can achieve this speed all the time, because their transmission does not depend on the vagaries of analog transmission with interference by various kinds of noise. A newer protocol called ADSL (Asymmetric Digital Subscriber Line) is upping the ante for fast data access over phone lines, but ISDN still has a bigger market right now.

In this section, we describe how to configure dial-up access to your Internet provider over an ISDN line. We'll cover only the most common style of connection, synchronous PPP, not the special mode called Raw IP over ISDN. Furthermore, this section discusses just internal ISDN boards, which require a very different kind of setup from the dial-up access covered in the previous section. To set up external ISDN devices, or the so-called ISDN modems (a term that is an oxymoron, because there is no modulation and demodulation), you can use commands similar to those in the previous section, because these devices present themselves to the computer and the operating system like a normal modem that offers some additional commands, faster connection setup, and higher throughput.

In a way, setting up ISDN connections is much easier than setting up analog connections, because many of the problems (bad lines, long connection setup times, and so on) simply cannot occur with digital lines. Once you dial the number, the connection is set up within milliseconds. But this can lead to problems. Since the connections are set up and shut down so fast, a misconfigured system that dials out again and again can cost you a fortune. This is even more so because with internal ISDN cards, you hear no clicking and whistling like with modems, and there are no lights that inform you that a connection has been made. You can check the status of your ISDN line with some simple programs, though.

Setting up dial-up PPP over ISDN is done in two steps:

1. Configure your ISDN hardware.

2. Configure and start the PPP daemon and change the routing table to use your ISDN line.

We will cover those steps in the next sections.

### 15.3.1. Configuring Your ISDN Hardware

The first step involves making your ISDN board accessible to the kernel. Like with any other hardware board, you need a device driver that must be configured with the correct parameters for your board.

Linux supports a large number of ISDN hardware boards. We cannot cover every single board here, but the procedure is more or less the same for each one. Reading the documentation for your specific card in the directory Documentation/isdn in the Linux kernel sources will help you a lot if your board is not covered here.

We will concentrate here on boards that use the so-called HiSax driver. This device driver works with most cards that use the Siemens HSCX chipset. That includes, for instance, the USR Sportster internal TA and the well-known Teles, ELSA, and Fritz boards. Other boards are similarly configured.

The first thing you need to do is configure the kernel so that it includes ISDN support. It is very advisable to compile everything ISDN-related as modules, especially while you are experimenting with setting it up. You will need the following modules:

- ISDN support.

- Support for synchronous PPP.

- One device driver module for your hardware. If you pick the HiSax driver, you will also have to specify which specific brand of ISDN card you have and which ISDN protocol you want to use. The latter is almost certainly EURO/DSS1, unless you live in Germany and have had your ISDN for a long time in which case it might be 1TR6. When in doubt, ask your phone company.

Compile and install the modules as described in Chapter 7, "Upgrading Software and the Kernel". Now you are ready to configure your ISDN hardware. Some distributions like SuSE make setting up ISDN lines very easy and comfortable. We cover the hard way here in case your distribution is not so user friendly, the automatic configuration does not work, or you simply want to know what is going on behind the scenes.

Now you need to load the device driver module using `modprobe`. This will automatically load the other modules as well. All the device driver modules accept a number of module parameters; the `hisax` modules accepts, among others, the following:

`id=`boardid

  Sets an identifier for the ISDN board. You can pick any name you like here, but you cannot have the same identifier for more than one board in your system.

`type=`boardtype

  Specifies the exact board brand and type. For example, a value of 16 for boardtype selects the support for the USR Sportster internal TA. See Documentation/isdn/README.hisax in the kernel sources for the full list of board types.

`protocol=`protocoltype

  Selects an ISDN subprotocol. Valid values for protocoltype are 1 for the old German `1TR6` protocol, 2 for the common `EDSS1` (so-called Euro ISDN) and 3 for leased lines.

`irq=`irqno

  Specifies the interrupt line to use. Not all boards need this.

`io=`addr

  Specifies the I/O address to use. Not all boards need this. Some boards need two I/O addresses. In this case, the parameters to use are `io0` and `io1`.

For example, the following command loads the HiSax driver for use with a Teles 16.3 board, Euro ISDN, IO address 0x280, and IRQ line 10 (a very common case):

>     tigger # modprobe hisax type=3 protocol=2 io=0x280 irq=10

Please see Documentation/isdn/README.HiSax or the equivalent file for your hardware for more information.

This module is not much of a talker; if there is no output from the `modprobe` command, it is likely that everything went well. You might also want to check your system log at /var/log/messages. You should see a few lines starting with `HiSax:` (or the name of the driver you are using), ending with:

>     HiSax: module installed

If the module did not load, you will most likely find the answer also in /var/log/messages. The most common problem is that the IRQ or I/O address was wrong or that you selected the wrong card type. If all else fails, and you have Windows installed on the same machine, boot up Windows and check what it reports for the IRQ and I/O address lines.

You should do one more check before you jump to the next section, and this check involves calling yourself. This can work because, with ISDN, you always have two phone lines at your disposition. Thus one line will be used for the outgoing "phone call" and the other line will be used for the incoming one.

In order to have the ISDN subsystem report what is going on with your phone lines, you will need to configure it to be more verbose than it is by default. You do this by means of three utility programs that are all part of the isdn4k-utils package that you can find at your friendly Linux FTP server around the corner.

The isdn4k-utils contain, among other things, the three utilities `hisaxctrl` for configuring the device driver, `isdnctrl` for configuring the higher levels of the ISDN subsystem, and `isdnlog`, a very useful tool that logs everything happening on your ISDN lines. While you can use `hisactrl` and `isdnctrl` without any configuration, you will need to provide a small configuration file for `isdnlog`. For now, we will content ourselves with a quick solution, but once your ISDN connection is up and running, you will want to configure `isdnlog` to see where your money is going. So for now, copy one of the sample configuration files contained in the `isdnlog` package to /etc/isdn/isdn.conf. You will at least need to edit the following lines:

`COUNTRYCODE=`

  Add your phone country code here, for example, 1 for the United States and Canada, 44 for the United Kingdom, 46 for Sweden, and so on.

`AREAPREFIX=`

  If the area codes in your country are prefixed by a fixed digit, put this in here. The prefix is 0 for most European countries, 9 for Finland, and nothing for the United States, Denmark, and Norway.

`AREACODE=`

  Put your area code in here. If you have specified an `AREAPREFIX` in the last step, don't repeat that here. For example, Stockholm, Sweden, has the area code 08. You put 0 into `AREAPREFIX` and 8 into `AREACODE.`

Once you have set this up, execute the following commands to make your ISDN system more verbose:

>     tigger # /sbin/hisaxctrl boardid 1 4
>     tigger # /sbin/isdnctrl verbose 3
>     tigger # /sbin/lsdnlog /dev/isdnctrl0 &

If you need to use a different driver from HiSax, you might need to use a different command. For example, for the PCBit driver, the command `pcbitctl` is available in the isdn4k-utils package.

Now you can go ahead and phone yourself. You should try all your MSNs (multiple subscriber numbers, which are your ISDN phone numbers) to see that the board can detect all of them. During or after each call, check /var/log/messages. You should see lines like the following:

>     Mar 16 18:34:22 tigger kernel: isdn_net: call from 4107123455,1,0 -> 123456
>     Mar 16 18:34:33 tigger kernel: isdn_net: Service-Indicator not 7, ignored

This shows that the kernel has detected voice call (the service indicator is 0) from the phone number 123455 in the area with the area code (0)4107 to the MSN 123456.

Note how the number called is specified, because you will need this information later. The number is sent with the area code in some phone networks, but without the area code in others. Anyway, congratulations if you have come this far. Your ISDN hardware is now correctly configured.

### 15.3.2. Setting Up Synchronous PPP

Setting up the PPP daemon again involves several substeps. On Linux, the ISDN board is treated like a network interface that you have to configure with special commands. In addition, you need to specify the username and password that your ISP has assigned you. When everything is configured, you start up the `ipppd` daemon, which lurks in the background until a connection request is made.

First, let's configure the "network interface." This involves a number of commands that most system administrators simply put into a script that they store in a file like /sbin/pppon. Here is a sample file that you can modify to your needs:

>     /sbin/isdnctrl addif ippp0
>     /sbin/isdnctrl addphone ippp0 out 0123456789
>     /sbin/isdnctrl dialmax ippp0 2
>     /sbin/isdnctrl eaz ippp0 123456
>     /sbin/isdnctrl huptimeout ippp0 100
>     /sbin/isdnctrl l2_prot ippp0 hdlc
>     /sbin/isdnctrl l3_prot ippp0 trans
>     /sbin/isdnctrl encap ippp0 syncppp
>     /sbin/ifconfig ippp0 1.1.1.1 pointopoint 123.45.67.89 metric 1

Let's go through these commands one by one:

`isdnctrl addif ippp0`

  Tells the kernel that a new ISDN interface with the name `ippp0` will be used. Always use names starting with `ippp`.

`isdnctrl addphone ippp0 out 0123456789`

  Tells the ISDN interface which phone number to use. This is the phone number that you use to dial up your provider. If you have used analog dial-up so far, check with your provider, because the phone number for ISDN access could be different.

`isdnctrl dialmax ippp0 2`

  Specifies how many times the kernel should dial if the connection could not be established before giving up.

`isdnctrl eaz ippp0 123456`

  Specifies one of your own MSNs here. This is very important--without this, not much will work. In case your provider verifies your access via your phone number, make sure that you specify the MSN here that you have registered with your provider.

`isdnctrl huptimeout ippp0 100`

  Specifies the number of seconds that the line can be idle before the kernel closes the connection (specified by last number in this command.) This is optional, but can save you a lot of money if you do not have a flat phone rate. Thus, if you forget to shut down the connection yourself, the kernel will do that for you.

`isdnctrl l2_prot ippp0 hdlc`

  Specifies the layer 2 protocol to use. Possible values here are `hdlc`, `x75i`, `x75ui`, and `x75bui`. Most providers use `hdlc`. When in doubt, ask your provider.

`isdnctrl l3_prot ippp0 trans`

  Specifies the layer 3 protocol to use (the `l` in the option is the letter L). Currently, only `trans` is available.

`isdnctrl encap ippp0 syncppp`

  Specifies the encapsulation to use. A number of values are possible here, but if you want to use synchronous PPP (or your provider demands that), you have to specify `syncppp` here. Another not-so-uncommon value is `rawip`. But since this provides only very weak authentication facilities, few providers still use it, even though it gives slightly better throughput because it has less overhead.

`ifconfig ippp0 1.1.1.1 pointopoint 123.45.67.89 metric 1`

  Creates the new network interface. If your IP address is not assigned dynamically (as is the case with most dial-up connections), you need to specify your IP address instead of the 1.1.1.1 here. Also, you need to change the 123.45.67.89 to the IP address of your provider's dial-up server.

Phew! But we are not finished yet. Next, you need to configure the `ipppd` daemon itself. This is done in the file /etc/ppp/ioptions. You can also have a configuration file specific to each `ipppd` daemon, but that is necessary only if you want to be able to use different ISDN connections, that is, if you have multiple dial-up accounts.

The following is an ioptions file that is generic enough to work with most providers. It does not give maximum throughput but is quite stable. If you want to optimize it, ask your provider about the possible settings and read the manual page for `ipppd` :

>     debug
>     /dev/ippp0
>     user yourusername
>     name yourusername
>     mru 1500
>     mtu 1500
>     ipcp-accept-local
>     ipcp-accept-remote
>     noipdefault
>     -vj -vjccomp -ac -pc -bsdcomp
>     defaultroute

You have to change only two things here: change `yourusername` in the third and fourth lines to the username that your provider has assigned you for connecting to his system. We won't go through all the options here; see the manual page when in doubt.

ISDN access requires the same security as an analog modem. See the section "PAP and CHAP" earlier in this chapter for directions on setting up your pap-secrets or chap-secrets file as required by your service provider.

Now we have got our things together and can start having fun! First run the `ipppd` daemon:

>     tigger # /sbin/ipppd pidfile /var/run/ipppd.ippp0.pid file /etc/ppp/ioptions &

The `ipppd` daemon will now wait for connection requests. Since we have not configured it yet to automatically make a connection, we have to manually trigger the connection. This is done with the following command:

>     tigger # isdnctrl dial ippp0

You should now check /var/log/messages. There should be lots of messages that start with `ipppd`. The last of those messages should be contain the words `local IP address` and `remote IP address` together with the IP addresses. Once you find those messages, you are done. Because we have used the `defaultroute` option previously, the kernel has set up the default route to use the ISDN connection, and you should now be able to access the wide, wide world of the Internet. Start by pinging your provider's IP address. Once you are done and want to shut down the connection, enter:

>     tigger # isdnctrl hangup ippp0

### 15.3.3. And If It Does Not Work?

If you have no connection even though your hardware was successfully recognized and you have set up everything as described here, /var/log/messages is again your friend. It is very likely that you will find the cause of the error there, even though it might be buried a bit.

The most common error is specifying the password or the username incorrectly. You know that you have a problem with the authentification if you see a line like:

>     PAP authentification failed

or:

>     CHAP authentification failed

in the log file. Check your chap-secrects or pap-secrets very carefully. Your provider might also be able to see from her log files where exactly the authentification went wrong.

Of course, it could also be the case that your provider does not support synchronous PPP as described here, even though most providers do nowadays. If this is the case, ask your provider for exact settings.

If it still does not work, ask your provider. A good ISP has a phone support line and can help you connect your Linux box. If your provider tells you that they "only support Windows," then it's time to switch. There are many Linux-friendly providers out there. Often the support staff is using Linux and can help you even though the provider's official policy is not to support Linux.

If for some reason you are stuck with an uncooperative provider, try finding other customers of this provider that also use Linux. Setting up your connection in nonstandard cases means fiddling with the options and parameters of the ISDN subsystem in the kernel and the `ipppd` daemon, and if somebody else has already found out what to do, you don't have to.

### 15.3.4. Where to Go from Here?

Once your ISDN connection works and you can access the Internet, you might want to set up some conveniences or other customizations. Here are some suggestions:

- Make `ipppd` dial your remote site automatically. This can be done by setting the default route to the `ippp0` device like this:

  >     /sbin/route add default netmask 0.0.0.0 ippp0

  Now, whenever the kernel needs to send an IP packet to an IP address for which it has no specific route configured, it will trigger the `ipppd` daemon to build a connection.

  Use this only if you have also specified the `huptimeout` option of the ISDN subsystem, otherwise you could pay a fortune to your telephone company (unless you have a flat rate).

  Since there are programs that try to build up Internet connections from time to time (Netscape is one of those candidates), setting this up can be dangerous for your wallet. If you use this, make sure to check the state of the connection often (see later in this section).

- Try tools that monitor your ISDN connection. The isdn4k-utils package contains a number of those tools, including the command-line tools `imon` and `imontty` and X-based tools.

- Configure `isdnlog` to log exactly what you need, and use `isdnrep` to get detailed reports about the usage of your ISDN line. This works not only for calls to and from computer systems but for calls to other ISDN-enabled devices like phones and fax machines. There is only one caveat: Your ISDN board cannot capture outgoing phone numbers for connections being set up by other devices. Most telephone companies provide a service, though, that echos this phone number back to you and thus lets the ISDN subsystem pick it up. This service is often available for free or for a nominal fee. Ask your telephone company.

- For the truly adventurous: Experiment with Multilink-PPP. As you know, with ISDN you have at least two lines. If you need extra high capacity, why not use both? That's what Multilink-PPP does. In order to use this, you need to turn on the `Support generic MP` option during kernel configuration and see the files Documentation/isdn/README.syncppp and Documentation/isdn/syncppp.FAQ in the kernel sources for hints on how to do this. Of course, your provider has to support this, too.

Copyright © 2001 O'Reilly & Associates. All rights reserved.